﻿#region

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

#endregion

namespace CuongHanh.Models.NotMapDB
{
    public class CustomerModel
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public string FullName { get; set; }

        [Required(ErrorMessage = "min leng 6 max lenght 30")]
        [MinLength(6)]
        [MaxLength(30)]
        public string Username { get; set; }

        [Required(ErrorMessage = "min leng 6 max lenght 31")]
        [MinLength(6)]
        [MaxLength(30)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [NotMapped]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessage = "Mật khẩu confirm không đúng.")]
        public string RePassword { get; set; }

        [Required]
        public string Phone { get; set; }

        [Required]
        [RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public string Email { get; set; }

        public string Address { get; set; }
    }

    public class CustomerLogin
    {
        [Required]
        public string Username { get; set; }

        [Required]
        public string Password { get; set; }

        public bool RememberMe { get; set; }
    }

    public class ResetPassWord
    {
        [Required]
        [RegularExpression(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*", ErrorMessage = "Email address is not valid")]
        public string Email { get; set; }
    }

    public class ChangePasswordByForgot
    {
        public ChangePasswordByForgot()
        {
        }

        public ChangePasswordByForgot(Customer model)
        {
            Id = model.Id;
            ResetKey = model.ResetKey;
        }

        public int Id { get; set; }

        [Required]
        public string ResetKey { get; set; }

        [Required(ErrorMessage = "min leng 6 max lenght 30")]
        [MinLength(6)]
        [MaxLength(30)]
        public string OldPassword { get; set; }

        [Required(ErrorMessage = "min leng 6 max lenght 31")]
        [MinLength(6)]
        [MaxLength(30)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [NotMapped]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessage = "Mật khẩu confirm không đúng.")]
        public string RePassword { get; set; }
    }

    public class ChangePassword
    {
        [Required]
        [MinLength(6)]
        [MaxLength(30)]
        public string OldPassword { get; set; }

        [Required]
        [MinLength(6)]
        [MaxLength(30)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [NotMapped]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessage = "Mật khẩu confirm không đúng.")]
        public string VerifyPassword { get; set; }
    }
}
